package com.example.myapplication.wifi

import android.annotation.SuppressLint
import android.net.ConnectivityManager
import android.net.Network
import com.example.myapplication.utils.Timber

/** wifi连接结果回调 */
@SuppressLint("NewApi")
object WifiConnectResultCallback : ConnectivityManager.NetworkCallback() {

    private var wifiName: String? = null

    override fun onAvailable(network: Network) {
        super.onAvailable(network)
        wifiName = WifiUtil.getWifiName()
        Timber.fi("wifi连接结果：($wifiName)已连接上")
    }

    override fun onLost(network: Network) {
        super.onLost(network)
        Timber.fi("wifi连接结果：($wifiName)已断开连接")
    }

}